package com.wzy.chain_responsibility.demo2;

import com.wzy.chain_responsibility.demo1.OrderContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: wzy
 * @Date: 2022/10/08/19:47
 * @Description:
 */
@Component
public class OrderHandleChainServiceDemo2 {

    @Autowired
    private List<OrderHandleInterceptDemo2> handleList;

    /**
     * 执行处理
     * @param context
     * @return
     */
    public OrderContext execute(OrderContext context){
        for (OrderHandleInterceptDemo2 handleIntercept : handleList) {
            context =handleIntercept.handle(context);
        }
        return context;
    }
}
